#加载包
library(ggplot2)
library("ggplot2")
library(ggpubr)
library(ggExtra)
install.packages("ggExtra")
library(ggExtra)
inputFile="HIF1AUBE2S.csv"
gene1="HIF1A"             #第一个基因名字
gene2="UBE2S"              #第二个基因名字
setwd("D:\BaiduNetdiskDownload\22相关性散点图")
setwd("D:/BaiduNetdiskDownload/22相关性散点图")
#读取输入文件，提取基因表达量
rt=read.table(inputFile,sep="\t",header=T,check.names=F,row.names=1)
x=as.numeric(rt[gene1,])
y=as.numeric(rt[gene2,])
#相关性分析
df1=as.data.frame(cbind(x,y))
corT=cor.test(x,y,method="spearman")
cor=corT$estimate
pValue=corT$p.value
p1=ggplot(df1, aes(x, y)) +
xlab(gene1)+ylab(gene2)+
geom_point()+ geom_smooth(method="lm",formula = y ~ x) + theme_bw()+
stat_cor(method = 'spearman', aes(x =x, y =y))
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
#出图
pdf(file="cor.pdf",width=5,height=4.8)
print(p1)
dev.off()
#出图2
pdf(file="cor.density.pdf",width=5,height=5)
print(p2)
#加载包
library(ggplot2)
rm(list=ls(all=T))
#加载包
library(ggplot2)
library(ggpubr)
library(ggExtra)
inputFile="HIF1AUBE2S.csv"
gene1="HIF1A"             #第一个基因名字
gene2="UBE2S"              #第二个基因名字
setwd("D:/BaiduNetdiskDownload/22相关性散点图")
#读取输入文件，提取基因表达量
rt=read.table(inputFile,sep="\t",header=T,check.names=F,row.names=1)
View(rt)
#读取输入文件，提取基因表达量
rt=read.csv(inputFile,sep="\t",header=F,check.names=F,row.names=1)
#读取输入文件，提取基因表达量
rt=read.csv(inputFile,sep=",",header=T,check.names=F,row.names=1)
View(rt)
x=as.numeric(rt[gene1,])
y=as.numeric(rt[gene2,])
#相关性分析
df1=as.data.frame(cbind(x,y))
corT=cor.test(x,y,method="spearman")
cor=corT$estimate
pValue=corT$p.value
p1=ggplot(df1, aes(x, y)) +
xlab(gene1)+ylab(gene2)+
geom_point()+ geom_smooth(method="lm",formula = y ~ x) + theme_bw()+
stat_cor(method = 'spearman', aes(x =x, y =y))
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
#出图
pdf(file="cor.pdf",width=5,height=4.8)
print(p1)
#出图
png(file="cor.pdf",width=5,height=4.8)
#出图
pdf(file="cor.pdf",width=5,height=4.8)
print(p1)
dev.off()
#出图2
pdf(file="cor.density.pdf",width=5,height=5)
print(p2)
dev.off()
library(ggExtra)
rm(list = ls(all=T))
#加载包
library(ggplot2)
library(ggpubr)
library(ggExtra)
inputFile="HIF1AUBE2S.csv"
gene1="HIF1A"             #第一个基因名字
gene2="UBE2S"              #第二个基因名字
#读取输入文件，提取基因表达量
rt=read.csv(inputFile,sep=",",header=T,check.names=F,row.names=1)
x=as.numeric(rt[gene1,])
y=as.numeric(rt[gene2,])
#相关性分析
df1=as.data.frame(cbind(x,y))
corT=cor.test(x,y,method="spearman")
cor=corT$estimate
pValue=corT$p.value
p1=ggplot(df1, aes(x, y)) +
xlab(gene1)+ylab(gene2)+
geom_point()+ geom_smooth(method="lm",formula = y ~ x) + theme_bw()+
stat_cor(method = 'spearman', aes(x =x, y =y))
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
#出图
pdf(file="cor.pdf",width=5,height=4.8)
print(p1)
dev.off()
#出图2
pdf(file="cor.density.pdf",width=5,height=5)
print(p2)
dev.off()
q()
q()
#install.packages("ggplot2")
#install.packages("ggpubr")
#install.packages("ggExtra")
rm(list = ls(all=T))
#加载包
library(ggplot2)
library(ggpubr)
library(ggExtra)
inputFile="HIF1AUBE2S.csv"
gene1="HIF1A"             #第一个基因名字
gene2="UBE2S"              #第二个基因名字
setwd("D:/BaiduNetdiskDownload/22相关性散点图")
#读取输入文件，提取基因表达量
rt=read.csv(inputFile,sep=",",header=T,check.names=F,row.names=1)
x=as.numeric(rt[gene1,])
y=as.numeric(rt[gene2,])
#相关性分析
df1=as.data.frame(cbind(x,y))
corT=cor.test(x,y,method="spearman")
cor=corT$estimate
pValue=corT$p.value
p1=ggplot(df1, aes(x, y)) +
xlab(gene1)+ylab(gene2)+
geom_point()+ geom_smooth(method="lm",formula = y ~ x) + theme_bw()+
stat_cor(method = 'spearman', aes(x =x, y =y))
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
#出图
pdf(file="cor.pdf",width=5,height=4.8)
print(p1)
dev.off()
#出图2
pdf(file="cor.density.pdf",width=5,height=5)
print(p2)
dev.off()
rm(list = ls(all=T))
#加载包
library(ggplot2)
library(ggpubr)
library(ggExtra)
inputFile="HIF1AUBE2S.csv"
gene1="HIF1A"             #第一个基因名字
gene2="UBE2S"              #第二个基因名字
setwd("D:/BaiduNetdiskDownload/22相关性散点图")
#读取输入文件，提取基因表达量
rt=read.csv(inputFile,sep=",",header=T,check.names=F,row.names=1)
x=as.numeric(rt[gene1,])
y=as.numeric(rt[gene2,])
#相关性分析
df1=as.data.frame(cbind(x,y))
corT=cor.test(x,y,method="spearman")
cor=corT$estimate
pValue=corT$p.value
p1=ggplot(df1, aes(x, y)) +
xlab(gene1)+ylab(gene2)+
geom_point()+ geom_smooth(method="lm",formula = y ~ x) + theme_bw()+
stat_cor(method = 'spearman', aes(x =x, y =y))
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
p1
P2
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
p2
rm(list = ls(all=T))
library(survival)
library(survminer)
q()
library(ggplot2)
library(ggpubr)
library(ggExtra)
inputFile="HIF1AUBE2S.csv"
gene1="HIF1A"             #第一个基因名字
gene2="UBE2S"              #第二个基因名字
setwd("D:/马明福/新文章/GEO数据库/GSE161533/相关性散点图HIF1AUBE2S")
#读取输入文件，提取基因表达量
rt=read.csv(inputFile,sep=",",header=T,check.names=F,row.names=1)
x=as.numeric(rt[gene1,])
y=as.numeric(rt[gene2,])
#相关性分析
df1=as.data.frame(cbind(x,y))
corT=cor.test(x,y,method="spearman")
cor=corT$estimate
pValue=corT$p.value
p1=ggplot(df1, aes(x, y)) +
xlab(gene1)+ylab(gene2)+
geom_point()+ geom_smooth(method="lm",formula = y ~ x) + theme_bw()+
stat_cor(method = 'spearman', aes(x =x, y =y))
p2=ggMarginal(p1, type = "density", xparams = list(fill = "orange"),yparams = list(fill = "blue"))
p2
#出图
pdf(file="cor.pdf",width=5,height=4.8)
print(p1)
dev.off()
#出图2
pdf(file="cor.density.pdf",width=5,height=5)
print(p2)
dev.off()
dev.off()
